home *** CD-ROM | disk | FTP | other *** search
- % +++ BEGIN of runfile PART 6 +++
-
- %%ThisPieceOfCodeName: (Generate PageSize for EPS files)
-
- %--------------------------------------------------------
- % Olaf Druemmer 02SEP97
- % Modified 06SEP97 od
- % Modified 10SEP98 od : restore/undefined error -> /CALS_save save def
- % (C) 1997 callas software gmbh - Berlin - Germany
- % Portions Copyrighted by Adobe, Inc.
- %--------------------------------------------------------
- % Detect if PostScript file is an EPS, extract BoundingBox
- % and derive PageSize from BoundingBox as well as
- % adapt offset with respective translate call
- % To be used as RunFile replacement
- %--------------------------------------------------------
- % IMPORTANT:
- % - Vor bisherigem RunFile Aufruf einfuegen
- % - statt RunFile --> PS_And_EPS_RunFile aufrufen
- % Aufruf-Konvention von PS_And_EPS_RunFile entspricht RunFile
- %--------------------------------------------------------
-
-
- %currentfile /ASCII85Decode filter cvx exec
- /CALS_Margin 1 def % bbox margin (units 1/72 inch)
-
- /CALS_PS_And_EPS_RunFile
- {
- /CALS_FileName exch def
- /CALS_save save def
- CALS_FileName (r) file /CALS_F exch def
- /CALS_S 32 string def CALS_F CALS_S readstring
- { pop } if
- CALS_S 0 get 197 eq /CALS_EPSPrev? exch def
- CALS_EPSPrev?
- {
- % (Processing EPS page ) print CALS_FileName print (\n) print
- CALS_S 7 get 256 mul CALS_S 6 get add 256 mul CALS_S 5 get add 256 mul CALS_S 4 get add
- /CALS_StartByte exch def
- CALS_S 11 get 256 mul CALS_S 10 get add 256 mul CALS_S 9 get add 256 mul CALS_S 8 get add
- /CALS_Length exch def
-
- /CALS_FX { CALS_F CALS_StartByte setfileposition
- CALS_F CALS_Length () /SubFileDecode filter /CALS_FF exch def } def
- }
- {
- % (Processing PostScript file ) print CALS_FileName print (\n) print
- /CALS_FX { /CALS_FF CALS_F def
- CALS_F 0 setfileposition } def
- }
- ifelse
-
- CALS_FX
- /CALS_S 255 string def
- CALS_FF CALS_S readline pop /CALS_SS exch def
- CALS_SS (%!PS-Adobe) anchorsearch
- {
- pop pop
- CALS_SS ( EPSF-) search
- { pop pop pop true }
- { pop false } ifelse
- }
- { pop false } ifelse
- /CALS_EPSHead? exch def
- CALS_EPSHead?
- {
- { CALS_FF CALS_S readline pop /CALS_SS exch def
- CALS_SS (%%) anchorsearch
- { pop pop
- CALS_SS (%%BoundingBox:) anchorsearch
- { pop pop
- mark
- CALS_SS 14 CALS_SS length 14 sub getinterval
- cvx exec
- counttomark 4 ne
- {
- (\(Msg 903: Unsupported coding for EPS bounding box\)) = flush
- CALS_SS = flush exit
- }
- {
- /CALS_URY exch def /CALS_URX exch def
- /CALS_BRY exch def /CALS_BRX exch def pop
- << /PageSize [ CALS_URX CALS_BRX sub CALS_Margin dup add add dup 72 lt { pop 72} if
- CALS_URY CALS_BRY sub CALS_Margin dup add add dup 72 lt { pop 72} if ] >> setpagedevice
- CALS_BRX CALS_Margin sub neg CALS_BRY CALS_Margin sub neg translate
- % (EPS page size set\n) print flush
- }
- ifelse
- }
- { pop } ifelse
- }
- { pop exit }
- ifelse
- } loop
- }
- {
- % (No EPS header\n) print
- }
- ifelse
-
- CALS_FX
- globaldict /CALS_DidWeShowPage? false put
- /CALS_TheRealShowPage /showpage load def
- /showpage { /CALS_DidWeShowPage? true store CALS_TheRealShowPage } def
-
- /CALS_save2 save def mark
- CALS_FF cvx exec
- cleartomark
- CALS_save2 restore
-
- CALS_DidWeShowPage? not
- { CALS_TheRealShowPage } if
-
- CALS_save restore
- }
- bind def
-
- % Note the double backslashes in the line below
- % (4 GB HD TESTEN:TEST-DATEI.EPS) PS_And_EPS_RunFile
- % showpage
- CALS_PS_And_EPS_RunFile
-
-
-
- % ???? RunFile
- (\(Msg 010: PDF file created\)) =
- }
- {
- % this will not work...
- (%%[ Error: prologue/epilogue.ps missing or not PDF 1.2 ]%%) =
- errordict /newerror true store
- }
- ifelse
- % (5) alles fertig!
- %%EOF
- % +++ END of runfile PART 6 +++
-